package com.czk.model.factory.simplefactory.pizzastore.orderpizza;

import com.czk.model.factory.simplefactory.pizzastore.pizza.CheesePizza;
import com.czk.model.factory.simplefactory.pizzastore.pizza.GreekPizza;
import com.czk.model.factory.simplefactory.pizzastore.pizza.Pizza;

/**
 * 工厂模式，商店提供需要的pizza类型，由工厂去生产
 * 如果需要扩展，则只需要修改工厂，增加工厂流水线即可
 */
public class SimpleFactory {

    public Pizza createPizza(String pizzaType){
        Pizza pizza=null;
        if (pizzaType=="greek"){
            pizza=new GreekPizza();
            pizza.setName("greek");
        }else if (pizzaType=="cheesepizza"){
            pizza=new CheesePizza();
            pizza.setName("cheesepizza");
        }
        return pizza;
    }
}
